package com.dbxt.dao;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.dbxt.entity.Record;
import com.dbxt.entity.RecordTeacher;
import com.dbxt.entity.Student;
import com.dbxt.entity.Teacher;
import com.dbxt.entity.Clerk;
import com.dbxt.entity.ClerkRecord;
import com.dbxt.entity.Files;

public interface TeacherMapper {
	/**
	 * 查询student基本信息 返回record
	 * @param sid
	 * @return
	 */
	Student selectRecordByStudent(Integer sid);
	
	/**
	 * 查询根据tid查到RecordTeacher对象 
	 * @param tid
	 * @return
	 */
	RecordTeacher selectRecordTeacherByTeacher(@Param("tid") Integer tid, @Param("rid") Integer rid);
	
	ClerkRecord selectClerkRecordByClerk(@Param("cid") Integer cid, @Param("rid") Integer rid);
	/**
	 * 根据获得的RecordTeacher修改信息
	 * @param recordTeacher
	 * @return
	 */
	boolean updateScoreAndCommitByTeacher(RecordTeacher recordTeacher);
	/**
	 * 若找不到rtid 添加recordteacher
	 * @param recordTeacher
	 * @return
	 */
	boolean insertRecordTeacher(RecordTeacher recordTeacher);
	
	/**
	 * 对记录与老师表计数老师个数
	 * @param rid
	 * @return
	 */
	int selectCountTeacher(Integer rid);
	/**
	 * 根据rid 获取到中间表对应的score
	 * @param rid
	 * @return
	 */
	List<RecordTeacher> selectCountGradeByTeacher(Integer rid);
	
	/**
	 * 修改record表中的平均分
	 * @param record
	 * @return
	 */
	boolean updateRecordGrade(Record record);
	/**
	 * 查找文件 通过文件id
	 * @param fid
	 * @return
	 */
	Files selectFile(Integer fid);
	/**
	 * 查找record对象
	 * @param rid
	 * @return
	 */
	Record selectRecordByStudentUpdate(Integer rid);
	/**
	 * 根据record修改答辩状态
	 * @param record
	 * @return
	 */
	boolean updateRecordByTeacher(Record record);
	
	Student  selectForeach(@Param("students") List<Student> students);
	
	List<Student> selectStudentList(@Param("grouping")String gruouping,@Param("tid")Integer tid);
	
	
	ClerkRecord selectCrid(Integer crid);
	
	RecordTeacher selectRtid(Integer rtid);

	boolean updateCrid(ClerkRecord clerkRecord);
	
	boolean updateRtid(RecordTeacher recordTeacher);
	
	Student checkResult(Integer sid);
	
	Teacher selectTeacher(Integer tid);
	
	Clerk selectClerk(Integer cid);
}